<?php
class PageModule
{
	function index() {
		global $_G;
		$id = empty($_GET['id']) ? getGP('url','G') : intval($_GET['id']);
        if (!$id)
        {
        	
        } else {
	        $page = $_G['cache']->get($id,'page');
	        if( !$page) {
	        	if(is_string($id)){
	        		$page = $_G['db']->fetch('page','*',array('urlname'=>$id));
	        	}else{
	        		$page = $_G['db']->fetch('page','*',array('id'=>$id));
	        	}
	        	if($page['id'] && $page['dateline'] < TIMESTAMP) {
	        		$_G['cache']->set($id,$page,'page');
	        	}else{
	        		$page = array();
	        	}
	        }
	        check_access('viewcagegory');
	        $_G['title'] = $page['title'];
	        if($page['summary']){
	        	$_G['description'] = strip_tags($page['summary']);
	        }else{
	        	$_G['description'] = $page['title'];
	        }
	       
	        include template('page');
        }
	}
}	